package com.dwxt.cdms.service;

import com.dwxt.cdms.dao.PolicyMapper;
import com.dwxt.cdms.entity.Policy;
import com.dwxt.common.base.BaseResult;
import com.dwxt.common.util.PartyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PolicyService {

    @Autowired
    private PolicyMapper policyMapper;

    public BaseResult page() {
        return BaseResult.ok(policyMapper.selectByPrimaryKey(1));
    }

    public BaseResult save(Policy policy) {
        policy.setUpdate_user(Integer.valueOf(PartyUtil.getCurrentUserId()));
        return BaseResult.ok(policyMapper.updateByPrimaryKeySelective(policy));
    }
}
